
import datetime
from typing import NamedTuple

TIME_FMT = "%Y-%m-%d/%H:%M:%S %u"
# 如果修改协议体，需要同时修改 Class *Headers *Body 和handle.py中的resolve和process.py中的所取字段
# 同时client.py中的字段可能也需要修改


class RequestHeaders(NamedTuple):
    method: int = 0
    accept: str = ""
    # accept_lang: str = ""
    token: str = ""
    date: str = datetime.datetime.now().strftime(TIME_FMT)
    version: str = ""


class ResponseHeaders(NamedTuple):
    status: int
    location: str
    content_type: str
    content_length: int
    connection: str
    version: str


class RequestBody(NamedTuple):
    account: int = None
    password: str = ""
    number: int = None
    pic: str = None
    info: str = None
    img: str = None
    msg: str = None
    name: str = None

    def __repr__(self):
        return r"{}".format(self.password)


class ResponseBody(NamedTuple):
    pass


# k: self.body[method] for k in self.methods
# p = Process(1)
# print(p.methods)


"""

{
   "headers":{
   "method":1,
   "accept":1,
"token":1,
"date":1,
"version":1
},
"body":{
"account":123,
"password":"159180"
}
}



{
   "headers":{
   "method":6,
   "accept":1,
"token":1,
"date":1,
"version":1
},
"body":{
"account":123,
"number": 21599180,
"password":"159180"
}
}

"""
